print(1 + 3) #算术运算
print("a" + "b") #拼接
print([1,2,3] + ["a","b","c"]) #合并

print(int().__add__)
print(str().__add__)
print(list().__add__)


# 二维坐标类
class Point:
    def __init__(self, x = 0, y = 0):
        self.x = x
        self.y = y

    # __add__ 控制了Point的实例相加应该是什么样的逻辑
    def __add__(self,other):
        x = self.x + other.x
        y = self.y + other.y
        return Point(x,y)

    # 控制了打印Point的实例时返回什么
    def __str__(self):
        return "({0},{1})".format(self.x, self.y)

p1 = Point(2,3)
p2 = Point(3,2)

p3 = (p1 + p2)
print(p3)